function passed = checkExperimentSetting()
% This is program is designed for check CAPS experiment setting. Program
% will check all the necessary files for normCAPS.m. It doesn't require
% input.

passed = true;

necessaryFileList = {'SAM\arousal.jpg'
    'SAM\dominance.jpg'
    'SAM\valence.jpg'
    '1440.jpg'
    '2722.jpg'
    '5500.jpg'
    'normCAPS.m'
    'postQuestionnaire.m'
    'age.txt'
    'degree.txt'
    'gender.txt'
    'noun1.txt'
    'noun2.txt'
    'pictureList.txt'
    'region.txt'};

for i = 1:length(necessaryFileList),
    searchResult = dir(necessaryFileList{i});
    if isempty(searchResult),
        passed = false;
        fprintf('file %s is missing.\n', necessaryFileList{i});
    end;
end;

try
    fid = fopen('pictureList.txt', 'r');
    trialImage = textscan(fid, '%s');
    fclose(fid);
catch EM
    fprintf('file pictureList.txt is missing. Cant check Pictures.\n');
    return;
end;

for i = 1:length(trialImage{1}),
    searchResult = dir(trialImage{1}{i}(:));
    if isempty(searchResult),
        passed = false;
        fprintf('Image %s is missing.\n', trialImage{1}{i}(:));
    end;
end;

return;